<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class RollSales extends Model
{
    use SoftDeletes;
    protected $table = 'roll_sales';

    public function getSoldToUserTypeAttribute()
    {
        $admin = Admin::find($this->sold_to_user_id);
        return $admin->user_type;
    }

    public function sold_to_user()
    {
        return $this->hasOne('App\Models\Admin', 'id', 'sold_to_user_id');
    }

    public function sold_by_user()
    {
        return $this->hasOne('App\Models\Admin', 'id', 'sold_by_user_id');
    }


}
